// print signals when changed !

module testa(
	input  [7:0]   din,
	output [7:0]   dout);
assign 			  dout 		  = din;

always@(dout)
begin
  $display("dout change to %x", dout);			//print when dout changed !
end
endmodule

module testb();
reg		  [7:0]   ctl_regs;
wire 	  [7:0]   flags;
assign 			  flags 	  = ctl_regs;		//this signal changed by the caller
always@(flags)
begin
  $display("flags change to %x", flags);
end
// initial begin
//   ctl_regs = 0;
//   repeat(10) begin
// 	#5 ctl_regs = $random%16'hff;
//   end
// end
endmodule


module test();
reg 	  [7:0]   din;
wire	  [7:0]   dout;

// testa ta(din, dout);
testb tb();
  
initial
begin
//   din = 0;
//   repeat(10)
//   begin
//   	#5 din = $random%16'hff;
//   end
  repeat(10)
  begin
  	#10 tb.ctl_regs = $random%16'hff;			//change the value of instance of testb
  end
end
endmodule


// clk generator
initial
begin
  clk = 0;
  forever #5 clk = ~clk;
end
end